/*!
    @header ManagedObjectsImporter
    @abstract A ManagedObjectsImporter allows you to import managed object from a xml file.
	@discussion A ManagedObjectsImporter needs to know two few things to import managed objects.
	<ol>
	<li>where to find the xml file containing the managed objects</li>
	<li>the name of the entity in which the objects should be imported</li>
	</ol>
*/

#import <Cocoa/Cocoa.h>
#import "MO2XMLCoreDataAccess.h"

@interface MO2XMLManagedObjectsImporter : MO2XMLCoreDataAccess {
	NSString *entityName;
	NSDictionary *properties;
	NSString *path;
	NSArray *managedObjectsAsDictionaries;
	NSURL *url;
}

/*!
    @method initWithContentsOfFile    
    @result Returns a initialized ManagedObjectsImporter object with the contents of the file specified by aPath.
*/
- (id)initWithContentsOfFile:(NSString *)aPath;
- (id)initWithContentsOfURL:(NSURL *)url;
- (void)dealloc;

- (NSArray *)managedObjectsAsDictionaries;

/*!
    @method entityName    
    @result Returns the entity name which is used.
*/
- (NSString *)entityName;

/*!
    @method setEntityName    
    @param value The name of the "destination" entity.
*/
- (void)setEntityName:(NSString *)value;

/*!
    @method properties    
    @result Returns the property dictionary which you can set with setProperties:(NSDictionary *)
*/
- (NSDictionary *)properties;

/*!
    @method setProperties    
	@discussion You can use a dictionary to change every imported managed object. The keys of
	this dictionary are the corresponding properties of the managed objects and the values of the dictionary 
	are the corresponding values of the managed object. If you pass a dictionary containing an object
	with the key "age" and the value "1" then every property "age" of the imported managed objects 
	will be set to 0. You can also define relationships with this dictionary of properties.
    @param value A dictionary defining the properties of each imported managed object.
*/
- (void)setProperties:(NSDictionary *)value;

/*!
    @method importManagedObjects   
	@discussion Imports the file defined with setPath:(NSString *) to the entity with the name defined by
	setEntityName(NSString *).
	@result Returns YES if everything went fine. Returns NO if something went wrong.
*/
- (BOOL)importManagedObjects;

/*!
    @method setPath   
	@discussion Sets the path used by the managed objects importer instance. When setting the path 
	the managed objects importer instance will automatically read the complete content of the file 
	specified by value. To start you import process you have to call importManagedObjects.
	@param value The path to use.
*/ 
- (void)setPath:(NSString *)value;

/*!
    @method path   
	@result The path which is used by the managed objects importer instance.
*/ 
- (NSString *)path;

- (NSArray *)managedObjectsAsDictionaries;
- (void)setManagedObjectsAsDictionaries:(NSArray *)value;
- (BOOL)setupManagedObjectsAsDictionaries;

- (NSURL *)url;
- (void)setUrl:(NSURL *)value;



@end
